﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OpenXML.DAL;
using OpenXML.BLL;

namespace OpenXML.Presentation.Front_office
{
    public partial class PersonalInformation : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ddlGender.Items.Clear();
            ddlCountry.Items.Clear();
            ddlCountryCode.Items.Clear();

            initDdlGender();
            initDdlCountry();
            initDdlCountryCode();  
        }

        protected void initDdlCountry()
        {
            CountryHandler ch = new CountryHandler();
            List<ListItem> listCountry = new List<ListItem>();
            
            listCountry = ch.getListCountriesOrdered();
            
            ddlCountry.Items.Add(new ListItem("--Select country--", "0"));
            for (int i = 0; i < listCountry.Count; i++)
                ddlCountry.Items.Add(new ListItem(listCountry[i].Text, listCountry[i].Value));
        }

        protected void initDdlCountryCode()
        {
            CountryHandler ch = new CountryHandler();
            List<ListItem> listCountry = new List<ListItem>();

            listCountry = ch.getListCountriesOrderedByCode();

            ddlCountryCode.Items.Add(new ListItem("--Select code--", "0"));
            for (int i = 0; i < listCountry.Count; i++)
                ddlCountryCode.Items.Add(new ListItem(listCountry[i].Value, listCountry[i].Value));
        }

        protected void initDdlGender()
        {
            ddlGender.Items.Add(new ListItem("--Select gender--", "2"));
            ddlGender.Items.Add(new ListItem("Mrs.", "0"));
            ddlGender.Items.Add(new ListItem("Mr.", "1"));
        }

        protected void btnUpload_Click(object sender, EventArgs e)
        {

        }

        protected void btnNext_Click(object sender, EventArgs e)
        {
            Response.Redirect("ApplicationForm.aspx");
        }
    }
}